<template>
  <div class="app-container">

    <el-row style="margin-top: 20px">
      <el-table v-loading="tableConf.loading" :stripe="true" :border="true" :data="tableData">
        <el-table-column align="center" width="50" prop="id" label="ID" />
        <el-table-column align="center" prop="realName" label="姓名" />
        <el-table-column align="center" min-width="50px" prop="crtTime" label="报名时间"/>
      </el-table>
    </el-row>
    <el-row style="margin-top: 20px">
      <el-pagination
        :page-sizes="tableConf.sizes"
        :page-size="tableConf.size"
        :total="tableConf.total"
        :current-page="tableConf.page"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-row>
  </div>
</template>

<script>

import {getTrainCustomerListApi} from "@/api/trainCode";

export default {
  name:'scanRecord',
  data() {
    return {
      tableData: [],
      tableConf: {
        page: 1,
        sizes: [10, 20, 50, 100],
        total: 0,
        size: 10,
        loading: false
      },
      filterData:{
        keyword: '',
        typeId: [],
        time:[],
      },
      placeTypeLoading: true,
      placeTypeOption: [],
    }
  },
  watch: {

  },
  mounted() {
    this.createParams(this);
    this.getTableList()
  },
  methods: {

    // 每页显示数量change
    handleSizeChange(e) {
      this.tableConf.size = e
      this.getTableList()
    },
    // 当前页change
    handleCurrentChange(e) {
      this.tableConf.page = e
      this.getTableList()
    },
    //获取列表
    getTableList() {
      this.tableConf.loading = true
      getTrainCustomerListApi({ page: this.tableConf.page, limit: this.tableConf.size, sid:this.sid}).then((res) => {
        this.tableData = res.list;
        this.tableConf.total = res.count;
      }).finally(() => {
        this.tableConf.loading = false
      })
    },


    refreshTable() {
      this.tableConf.page = 1
      this.getTableList()
    }
  }
}
</script>
<style lang="scss" scoped>
.filterData-block {
  .el-form-item {
    margin-bottom: 0;
  }
}
</style>
